﻿using System.Text.RegularExpressions;
using SoccerLiveScores.Models;

namespace SoccerLiveScores.Extensions
{
    public static class ExtensionMethods
    {
        public static void StripHTML(this ScoreModel model)
        {
            model.Title = StripHTML(model.Title);
            model.Description = StripHTML(model.Description);
            model.PubDate = StripHTML(model.PubDate);
        }

        static string StripHTML(string inputString)
        {
            const string HTML_TAG_PATTERN = "<.*?>";

            return Regex.Replace
              (inputString, HTML_TAG_PATTERN, string.Empty);
        }
    }
}
